
prepper <- function(x,names=tablenames){
  # A function to prepare vectors of column labels
  # for the tabular presentation of results in the
  # appendix/supplementary information.
  foo <- strsplit(x,split=" ")
  foo <- unlist(foo)
  foo <- unique(foo)
  # Cleanup
  foo <- foo[which(foo!="+")]
  foo <- foo[which(foo!=" + ")]
  foo <- foo[which(foo!=" ")]
  foo <- foo[which(foo!="")]
  foo <- foo[which(foo!="\n")]
  foo <- foo[which(foo!="+\n")]
  
  foo2 <- rep(NA,length(foo))
  for(i in 1:length(foo)) 
  {
    foo2[i] <- names[which(names[,1]%in%foo[i]),2]
  }
  foo <- cbind(foo,foo2)
  # names(foo) <- names[which(names[,1]%in%foo),2]
  colnames(foo) <- c("Variable","Label")
  return(foo)
}